﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
//using System.Windows.Forms;

namespace Dotnet.Code.Extend
{
    public static partial class Ext
    {
        public static bool IsDevEnv(this object application)
        {
            //string exe = System.IO.Path.GetFileName(Application.ExecutablePath);
            //if (exe == "devenv.exe")
            //    return true;
            return false;
        }
        public static void WriteLineConsole(this object app, string remark)
        {
            DateTime dt = DateTime.Now;
            System.Diagnostics.StackFrame stf = new System.Diagnostics.StackTrace(true).GetFrame(1);
            StringBuilder sb = new StringBuilder();
            Thread t = Thread.CurrentThread;
            Console.WriteLine("{0:HH:mm:ss.fff} L:{1,-4}{2,-12}\t当前线程名:{3,-5} ID:{4} 状态:{5,-13} 优先级:{6}\t{7} ",
                dt, stf.GetFileLineNumber(), remark, t.Name, t.ManagedThreadId, t.ThreadState, t.Priority, sb.ToString());
        }
        public static void WriteLineText(this object app, string remark)
        {
            DateTime dt = DateTime.Now;
            System.Diagnostics.StackFrame stf = new System.Diagnostics.StackTrace(true).GetFrame(1);
            StringBuilder sb = new StringBuilder();
            Thread t = Thread.CurrentThread;
            //NewLife.Log.XTrace.WriteLine("{0:HH:mm:ss.fff} L:{1,-4}{2,-12}\t当前线程名:{3,-5} ID:{4} 状态:{5,-13} 优先级:{6}\t{7} ",
                //dt, stf.GetFileLineNumber(), remark, t.Name, t.ManagedThreadId, t.ThreadState, t.Priority, sb.ToString());
            //Console.WriteLine("{0:HH:mm:ss.fff} L:{1,-4}{2,-12}\t当前线程名:{3,-5} ID:{4} 状态:{5,-13} 优先级:{6}\t{7} ",
            //    dt, stf.GetFileLineNumber(), remark, t.Name, t.ManagedThreadId, t.ThreadState, t.Priority, sb.ToString());
        }
       
    }
}
